package work.mediway.mdm.biz.listener;

import com.mediway.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
import com.mediway.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;

import org.springframework.stereotype.Component;

import lombok.RequiredArgsConstructor;
import work.mediway.mdm.biz.service.biz.BpmDictService;

/**
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2022/8/10
 */
@Component
@RequiredArgsConstructor
public class BpmDictApplyResultListener extends BpmProcessInstanceResultEventListener {

    private final BpmDictService bpmDictService;

    @Override
    protected String getProcessDefinitionKey() {
        return "dict_apply";
    }

    @Override
    protected void onEvent(BpmProcessInstanceResultEvent event) {
        System.out.println("event = " + event);
        this.bpmDictService.updateDictApplyResult(Long.parseLong(event.getBusinessKey()), event.getResult());
    }
}
